package com.eportal.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by smzhang on 2016/1/5.
 */
public class ForegroudPerm {

    private static Map<Integer, List<String>> perms = new HashMap<Integer, List<String>>();

    private ForegroudPerm() {
        /**
         * 未合作
         */
        List basic = new ArrayList() {{
            add("/home.action");
            add("/purchase/listView.action");
            add("/purchase/addView.action");
            add("/purchase/add.action");
            add("/purchase/cancel.action");
            add("/purchase/list.action");
            add("/address/list.action");
            add("/address/addView.action");
            add("/address/editView.action");
            add("/address/list.action");
            add("/address/add.action");
            add("/address/edit.action");
            add("/address/del.action");
            add("/bill/addView.action");
            add("/bill/updateView.action");
            add("/bill/add.action");
            add("/bill/update.action");
            add("/bill/del.action");
            add("/bill/list.action");
            add("/count/detail.action");
            add("/count/rsetView.action");
            add("/count/edit.action");
            add("/count/reset.action");
        }};
        perms.put(0, basic);

        /**
         * 测试中
         */
        List list = new ArrayList();
        list.addAll(basic);
        list.addAll(new ArrayList() {{
            add("/lock/listView.action");
            add("/lock/list.action");
            add("/lock/editView.action");
            add("/lock/edit.action");
            add("/lock/toTest.action");
            add("/lock/toFormal.action");
            add("/sdk/list.action");
            add("/developer/doc.action");
            add("/resource/listView.action");
            add("/resource/list.action");
            add("/manage/listView.action");
            add("/manage/list.action");
            add("/resource/loadView.action");
            add("/resource/addView.action");
            add("/resource/add.action");
            add("/resource/editView.action");
            add("/resource/del.action");
            add("/resource/edit.action");
            add("/manage/addView.action");
            add("/community/data.action");
            add("/manage/add.action");
            add("/manage/editView.action");
            add("/manage/edit.action");
            add("/manage/del.action");
            add("/sdk/download.action");
            add("/resource/load.action");
            add("/tmirrorAgent/edit.action");
            add("/tmirrorAgent/saveEdit.action");
        }});
        perms.put(1, list);

        /**
         * 合作中
         */
        List all = new ArrayList();
        all.addAll(list);
        all.addAll(new ArrayList() {{
            add("/community/addView.action");
            add("/community/editView.action");
            add("/community/listView.action");
            add("/community/list.action");
            add("/keys/listView.action");
            add("/keys/list.action");
            add("/purchase/listView.action");
            add("/purchase/list.action");
            add("/community/add.action");
            add("/community/edit.action");
            add("/lock/editView.action");
            add("/lock/edit.action");
            add("/lock/toTest.action");
            add("/lock/toFormal.action");
            add("/tmirrorAgent/edit.action");
            add("/tmirrorAgent/saveEdit.action");
        }});
        perms.put(2, all);
    }

    public static List getPerms(Integer status) {
        if (perms.isEmpty()) {
            new ForegroudPerm();
        }
        return perms.get(status);
    }
}
